Option Explicit

'create stacks for all running tasks
Dim StackRcIntrepreter (1 To 100) As Byte
Dim StackMainModule (1 To 100) As Byte
Dim StackWayPointPgrm (1 To 16) As Byte
Dim StackMotorControl (1 To 100) As Byte

'constants to make reading passed variables easier
Public Const NO_PWR as Integer	 	 = 0 '0% power
Public Const QTR_PWR as Integer		 = 1 '25% power
Public Const HALF_PWR as Integer	 = 2 '50% power
Public Const THR_QTR_PWR as Integer	 = 3 '75% power
Public Const FULL_PWR as Integer	 = 4 '100% power

'''the signal lines for all the tasks are below this line'''

'for gps and rc only to talk to main module
Public rc_activate As Boolean
Public gps_activate As Boolean
Public forward As Boolean	
Public reverse As Boolean
Public right As Boolean
Public left As Boolean
Public fb_power As Integer
Public lr_power As Integer

'for motor controller to talk to main module 
'This is in the form of a PWM signal
Public left_power As Integer
Public right_power As Integer

Public Sub Main()
	rc_activate = FALSE
	gps_activate = FALSE
	left_power = NO_PWR
	right_power = NO_PWR

	CallTask "RcIntrepreter", StackRcIntrepreter 
	CallTask "MainModule", StackMainModule  
	'CallTask "WayPointPgrm", StackWayPointPgrm 
	CallTask "MotorControl", StackMotorControl 

	Do 'Go to sleep forever while the tasks work
		Call Sleep(120.0)
	Loop
End Sub
